Recently, a moving image coding method in which a encoding efficiency is largely improved is recommended as ITU-T Rec. H.264 and ISO/IEC 14496-10 (hereinafter referred to as H.264) by ITU-T and ISO/IEC. In H.264, prediction processing, transform processing, and entropy coding processing are performed in rectangular block units (for example, a 16-by-16 pixel block unit and an 8-by-8 pixel block unit). In the prediction processing, motion compensation is performed to a rectangular block of an encoding target (hereinafter referred to as an encoding target block). In the motion compensation, a prediction in a temporal direction is performed by referring to an already-encoded frame (hereinafter referred to as a reference frame). In the motion compensation, it is necessary to encode and transmit motion information including a motion vector to a decoding side. The motion vector is information on a spatial shift between the encoding target block and a block referred to in the reference frame. In the case that the motion compensation is performed using a plurality of reference frames, it is necessary to encode a reference frame number in addition to the motion information. Therefore, an code amount related to the motion information and the reference frame number may increase.
A direct mode, in which the motion vector to be allocated to the encoding target block is derived from the motion vectors allocated to the already-encoded blocks and the predicted image is generated based on the derived motion vector, is cited as an example of a method for evaluating the motion vector in motion compensation prediction (see JP-B 4020789 and U.S. Pat. No. 7233621). In the direct mode, because the motion vector is not encoded, the code amount of the motion information can be reduced. For example, the direct mode is adopted in H.264/AVC.
In the direct mode, the motion vector of the encoding target block is predicted and generated by a fixed method for calculating the motion vector from a median of the motion vectors of the already-encoded blocks adjacent to the encoding target block. Therefore, the motion vector calculation has a low degree of freedom.
A method for selecting one already-encoded block from the already-encoded blocks to allocate the motion vector to the encoding target block has been proposed in order to enhance the degree of freedom of the motion vector calculation. In the method, it is necessary to always transmit selection information identifying the selected block to the decoding side such that the decoding side can identify the selected already-encoded block. Accordingly, the code amount related to the selection information increases in the case that the motion vector to be allocated to the encoding target block is decided by selecting one already-encoded block from the already-encoded blocks.